import Mock from 'mockjs'

const user = 'admin'
const pwd = '12345'

function loginIn({ body }) {
    const bodyObj = JSON.parse(body)
    if (bodyObj.user === user && bodyObj.pwd === pwd) {
        return {
            code: 1,
            token: 'bla-bla'
        }
    } else {
        return {
            code: 0,
            message: '账号或密码错误'
        }
    }

}

Mock.mock(/\/loginIn\/data/, 'post', loginIn)